<? session_start();
						
include_once ('core/conn.php');
						
$db = get_conn();
						
check_session();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Flexigrid</title>
<link href="css/admin_styles.css" rel="stylesheet" type="text/css" />
</head>

<body>

 
<table width='100%' border='0' id="content_manager">
  <tr>
    <td valign='top'  style="text-align:center"><input type="button" name="xxx" id="xxx" value="Create New Entry" onclick="document.location.href='content_manager.php';" /></td>
  </tr>
  <tr>
    <td valign='top'>&nbsp;</td>
  </tr>
  <tr>
    <td valign='top'><? 
		if($_GET['sort']!=''){
			$sort = " order by ".$_GET['sort'];
		
			if($_SESSION['format']==' asc'){
			   $_SESSION['format']=' desc';
			}else{
			   $_SESSION['format']=' asc';	
			}
			
			$sort .= $_SESSION['format'];
			
			
		}else{
			$sort = " order by id_contenido desc";
		}	
		$where =1;
		

		$sql = "SELECT id_contenido,label,texto,texto2,texto3 FROM contenido where cstatus='A' and  $where $sort $limit";
		//echo $sql;	
		$result = mysql_query($sql);
			
		if($result){
				
			$data ="<table width='100%'>";
				
			if(mysql_num_rows($result) > 0){
					$data .="<tr>
						<td align='left' class='table_header'>
							<a  href='?sort=id_contenido' title='Click to sort by ID'>ID</a>
						</td>
						<td align='left' class='table_header'>
							<a  href='?sort=label' title='Click to sort by Label'>Label</a>
						</td>
						<td align='left' class='table_header'>
							<a  href='?sort=texto' title='Click to sort by Spanish'>Spanish</a>
						</td>
						<td align='left' class='table_header'>
							<a  href='?sort=texto2' title='Click to sort by French'>French</a>
						</td>
						<td align='left' class='table_header'>
							<a  href='?sort=texto3' title='Click to sort by English'>English</a>
						</td>																								
						</tr>";
						
					$data .="<tr>
						<td align='left' colspan='5' >
									&nbsp;
						</td>																								
						</tr>";										
					
				while($row = mysql_fetch_array($result)){
						
					$data .="<tr>
											
						<td align='left' >
												
							<a class='small' href='content_manager.php?id=".$row['id_contenido']."'>".$row['id_contenido']."</a>
											
						</td>
						<td align='left' >
							<a class='small' href='content_manager.php?id=".$row['id_contenido']."'>".htmlentities($row['label'])."</a>
						</td>
						
						<td align='left' >
							<a class='small' title=\"".htmlentities($row['texto'])."\" href='content_manager.php?id=".$row['id_contenido']."'>".substr(htmlentities($row['texto']),0,50)."</a>
						</td>
						
						<td align='left' >
							<a class='small' title=\"".htmlentities($row['texto2'])."\" href='content_manager.php?id=".$row['id_contenido']."'>".substr(htmlentities($row['texto2']),0,50)."</a>
						</td>
						
						<td align='left' >
							<a class='small' title=\"".htmlentities($row['texto3'])."\" href='content_manager.php?id=".$row['id_contenido']."'>".substr(htmlentities($row['texto3']),0,50)."</a>
						</td>																								
						
										  
						</tr>";
					
				}//while
				
			}//if
				
			else{
					
				$data .= "<tr><td align='center'>No hay contenido registrados</td></tr>";			
				
			}
				
			$data .="</table>";
			
		}else{
				
			error_handling($sql,mysql_error());
			
		}
			
		echo $data;
			
		?></td>
  </tr>
</table>
</body>
</html>
